package com.lsu.prototype.homework;

/**
 * 测试类
 *
 * @Author wang suo
 * @Date 2020/11/30 0030 13:12
 * @Version 1.0
 */
public class Test {
    public static void main(String[] args) {
        Horse horse = new Horse();
        // 第一个骑士
        Person p1 = new Person(horse);
        // 第二个骑士
        Person p2 = (Person) p1.cloneSelf();
        p1.run();
        p2.run();
        // fileName = "archive.txt"; path = "D:"

        /*
        保存到本地
         */
        p2.archive("D:", "archive.txt");
        System.out.println("---------------------------");
        System.out.println("---p2 存档成功! 现在距离--" + p2.getMount().getDistance() + "米");
        System.out.println("---------------------------");

        /*
        实现现场恢复
         */
        Person p3 = p2.readArchive("D:", "archive.txt");
        System.out.println("---------------------------");
        System.out.println("---读取存档成功! 现在距离--" + p3.getMount().getDistance() + "米");
        System.out.println("---------------------------");
        p3.run();
    }
}